/**
 * 
 */
package com.heer.RD.web;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

import com.heer.RD.auth.HeerAuthorizationStrategy;
import com.heer.RD.auth.HeerSession;
import com.heer.RD.projecthour.page.LoginPage;
import com.heer.RD.projecthour.page.MainPage;

/**
 * @author ZhaoZehui
 *
 */
public class HeerWebApplication extends WebApplication {

	/* (non-Javadoc)
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	@Override
	public Class<? extends Page> getHomePage() {
		return MainPage.class;
	}
	
	@Override
    public HeerSession newSession(Request request, Response response) {
        return new HeerSession(request);
    }
	
	@Override
	protected void init() {
		super.init();
		getDebugSettings().setDevelopmentUtilitiesEnabled(true);
        getDebugSettings().setAjaxDebugModeEnabled(false);

        getSecuritySettings().setAuthorizationStrategy(new HeerAuthorizationStrategy());

		addComponentInstantiationListener(new SpringComponentInjector(this));
		
		mountBookmarkablePage("/login", LoginPage.class);
        mountBookmarkablePage("/main", MainPage.class);
	}

}
